﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ImportExport.ascx.cs" Inherits="Admin_Components_Report_ImportExport" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True">
</telerik:RadScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <telerik:RadTabStrip ID="TabStrip1" runat="server" EnableDragToReorder="true" Skin="Vista" MultiPageID="RadMultiPag1" >
            <Tabs>
                 <telerik:RadTab Text="TÌM KIẾM" Selected="True">
                </telerik:RadTab>
                <telerik:RadTab Text="CHI TIẾT"></telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
       
        <telerik:RadMultiPage ID="RadMultiPag1" runat="server" SelectedIndex="0">
            <!--Tab thông tin chung -->
            <telerik:RadPageView ID="RadPageView1" runat="server"  Style="overflow: hidden">
                 <fieldset class="form" id="fsGeneral">
                     <br />
               <div class="form-horizontal wrapper-center clearfix">
                <!--Block bên trái -->
                 <div class="form-group col-md-6">
                     <div class="form-group">
                    <label class="col-md-4 control-label">Tỉnh thành</label>
                    <div class="col-md-8">
                        <telerik:RadComboBox ID="cboProvince" runat="server" CssClass="col-imp-8" OnSelectedIndexChanged="cboProvince_SelectedIndexChanged" AutoPostBack="true">  
                        </telerik:RadComboBox>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-4 control-label">Cửa hàng</label>
                        <div class="col-md-8">
                           <%--<telerik:RadComboBox ID="cbShop" runat="server" CssClass="col-imp-8"  />--%>
                            <telerik:RadListBox ID="cbShop" runat="server" CheckBoxes="true" ShowCheckAll="true" Width="220px"
                Height="150px" ></telerik:RadListBox>
                         </div>
                    </div>
                </div>
                 <!--End Block bên trái -->
                 <!--Block bên phải -->
                <div class="form-group col-md-6">
                      <div class="form-group">
                        <label class="col-md-3 control-label">
                            Từ ngày</label>
                        <div class="col-md-8">
                        <telerik:RadDatePicker ID="rtpFromDateSearch" cssclass="col-imp-8" enabled="true" runat="server">
                            <Calendar ID="Calendar1" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                            </Calendar>
                            <DateInput ToolTip="Từ ngày" style="width:100px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"></DateInput>
                        </telerik:RadDatePicker>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Đến ngày</label>
                        <div class="col-md-8">
                        <telerik:RadDatePicker ID="rtpToDateSearch" cssclass="col-imp-8" enabled="true" runat="server">
                            <Calendar ID="Calendar2" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                            </Calendar>
                            <DateInput ToolTip="Đến ngày" style="width:100px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"></DateInput>
                        </telerik:RadDatePicker>
                        </div>
                    </div>
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Thuộc loại</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cbTypeSearch" runat="server" CssClass="col-imp-5"  AutoPostBack="true" OnSelectedIndexChanged="cbType_SelectedIndexChanged">
                                <Items>
                                    <telerik:RadComboBoxItem Text="---Tất cả---" Value="" />
                                    <telerik:RadComboBoxItem Text="Gạo" Value="R" />
                                    <telerik:RadComboBoxItem Text="Quà tặng" Value="P" />
                                </Items>
                            </telerik:RadComboBox>
                        </div>
                    </div>
                  <!--End Dòng -->
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Tên sản phẩm</label>
                        <div class="col-md-8">
                          <telerik:RadComboBox ID="cbProduct" runat="server" CssClass="col-imp-8"  ></telerik:RadComboBox>
                         </div>
                    </div>
                    <!--End Dòng -->
                </div>
                 <!--End Block bên phải -->
                </div>
            </fieldset>
               <!--Action-->
        <div class="set-btns text-center">
            <asp:Button ID="btnSearch" CssClass="btn btn-sm btn-primary" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click"/>
            <asp:Button ID="btnExportExcel" runat="server" CssClass="btn btn-sm btn-primary" Text="Xuất Excel" OnClick="btnExportExcel_Click"/>
        </div>
        <div class="row">
            <div style="float: left;font-weight:bold" runat="server" id="div_TotalRows" >&nbsp;Kết quả tìm kiếm: 0</div>
            <telerik:RadGrid ID="gvData" runat="server" AutoGenerateColumns="False" CellSpacing="0" PageSize="10" AllowCustomPaging="true"
                    AllowMultiRowSelection="True" GridLines="None" HeaderStyle-HorizontalAlign="Center" OnNeedDataSource="gvData_NeedDataSource" OnItemCommand="gvData_ItemCommand"
                    HeaderStyle-BorderStyle="None" CssClass="table table-bordered" >
                    <MasterTableView EditMode="InPlace" ShowHeader="true"
                        AutoGenerateColumns="False" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true" AllowPaging="True" PageSize="10" >
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        </ExpandCollapseColumn>
                        <Columns>
                         <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Eval("RowID") %>
                            </ItemTemplate>
                            <HeaderStyle Width="50px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn  DataField="ProductName" UniqueName="ProductName"  ReadOnly="true" HeaderText="Tên sản phẩm">
                            <HeaderStyle HorizontalAlign="Center"  Width="300px" />
                            <ItemStyle HorizontalAlign="Left" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn  DataField="ShopName" UniqueName="ShopName"  ReadOnly="true" HeaderText="Tên cửa hàng">
                            <HeaderStyle HorizontalAlign="Center" Width="200px"/>
                            <ItemStyle HorizontalAlign="Left" />
                        </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn  DataField="ProductType" UniqueName="ProductType"  ReadOnly="true" HeaderText="Loại">
                            <HeaderStyle HorizontalAlign="Center" Width="100px"/>
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Số lượng nhập" DataField="QuantityImport" UniqueName="QuantityImport"   ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnQuantityImport" CommandArgument='<%# "I;"+Eval("ShopID")+ ";" + Eval("ProductID")%>' CommandName="ItemDetail" runat="server"><asp:Label ID="lblQuantityImport" runat="server" Text='<%#String.Format("{0:N0}", Eval("QuantityImport"))%>' DataFormatString="{0:N0}" style="cursor:pointer;color:green;font-weight:bold;"></asp:Label></asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center"   />
                        <ItemStyle HorizontalAlign="Right" />
                        </telerik:GridTemplateColumn>
                         <telerik:GridBoundColumn  DataField="WeightImport" UniqueName="WeightImport" DataFormatString="{0:N0}"  ReadOnly="true" HeaderText="Trọng lượng nhập(Kg)">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Right"/>
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Số lượng xuất" DataField="QuantityExport" UniqueName="QuantityExport"  ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnQuantityExport" CommandArgument='<%# "O;"+Eval("ShopID")+ ";" + Eval("ProductID")%>' CommandName="ItemDetail" runat="server"><asp:Label ID="lblQuantityExport" runat="server" Text='<%#String.Format("{0:N0}", Eval("QuantityExport"))%>' DataFormatString="{0:N0}" style="cursor:pointer;color:green;font-weight:bold;"></asp:Label></asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center"   />
                        <ItemStyle HorizontalAlign="Right" />
                        </telerik:GridTemplateColumn>
                        <%--<telerik:GridBoundColumn  DataField="QuantityExport" UniqueName="QuantityExport" DataFormatString="{0:N0}"  ReadOnly="true" HeaderText="Số lượng xuất">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Right" />
                        </telerik:GridBoundColumn>--%>
                       
                         <telerik:GridBoundColumn  DataField="WeightExport" UniqueName="WeightExport" DataFormatString="{0:N0}"  ReadOnly="true" HeaderText="Trọng lượng xuất(Kg)">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Right" />
                        </telerik:GridBoundColumn>
                            <%--<telerik:GridBoundColumn  DataField="QuantityRemain" UniqueName="QuantityRemain" DataFormatString="{0:N0}"  ReadOnly="true" HeaderText="Số lượng tồn">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Right"/>
                        </telerik:GridBoundColumn>
                         <telerik:GridBoundColumn  DataField="WeightRemain" UniqueName="WeightRemain" DataFormatString="{0:N0}"  ReadOnly="true" HeaderText="Trọng lượng tồn(Kg)">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Right" />
                        </telerik:GridBoundColumn>--%>
                        </Columns>
                    </MasterTableView>
               </telerik:RadGrid> 
            </div>
            </telerik:RadPageView>
            <%-- End Tìm Kiếm --%>
            <%-- Chi tiết --%>
            <telerik:RadPageView ID="RadPageView2" runat="server"  Style="overflow: hidden">
            <fieldset class="form" id="Fieldset2">
                  <br />
                <div class="set-btns text-center">
                <asp:Button ID="btnExportDetail" runat="server" CssClass="btn btn-sm btn-primary" Text="Xuất Excel"  OnClick="btnExportDetail_Click"/>
                    </div>
            <!--Grid data-->
            <div class="row">
                <div style="float: left;font-weight:bold" runat="server" id="div_DetailTotal" >&nbsp;Kết quả tìm kiếm: 0</div>
                <%--<div style="float: right;"><asp:Button ID="btnRefresh" CssClass="btnRefresh" ToolTip="Refresh" runat="server" Text="Refresh"  /></div> --%>
            <telerik:radgrid id="gv_detail" runat="server" cellspacing="0" cssclass=" table table-bordered"
                gridlines="None" autogeneratecolumns="False" headerstyle-horizontalalign="Center" PageSize="10" AllowCustomPaging="true"
                allowmultirowselection="True" headerstyle-borderstyle="None"  ShowHeader="true" OnNeedDataSource="gvDetail_NeedDataSource" >
                
                <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true" AllowPaging="True" PageSize="10" EditMode="InPlace">
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                 <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Eval("RowID") %></ItemTemplate>
                        <HeaderStyle Width="30px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn  DataField="Code" UniqueName="Code"  ReadOnly="true" HeaderText="Mã giao dịch">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="TransactionType" UniqueName="TransactionType"   ReadOnly="true" HeaderText="Loại giao dịch">
                            <HeaderStyle HorizontalAlign="Center"  Width="150px"/>
                            <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn  DataField="ShopName" UniqueName="ShopName"  ReadOnly="true" HeaderText="Cửa hàng">
                        <HeaderStyle HorizontalAlign="Center"  Width="200px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="ProductName" UniqueName="ProductName"  ReadOnly="true" HeaderText="Sản phẩm">
                        <HeaderStyle HorizontalAlign="Center"  Width="200px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="Quantity" UniqueName="Quantity" DataFormatString="{0:N0}"  ReadOnly="true" HeaderText="Số lượng">
                            <HeaderStyle HorizontalAlign="Center"  Width="100px"/>
                            <ItemStyle HorizontalAlign="Right" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="Weight" UniqueName="Weight" DataFormatString="{0:N0}"  ReadOnly="true" HeaderText="Trọng lượng(Kg)">
                            <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                            <ItemStyle HorizontalAlign="Right" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="Date" UniqueName="Date"  ReadOnly="true" HeaderText="Ngày cập nhật">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn  DataField="LastUpdatedBy" UniqueName="LastUpdatedBy"  ReadOnly="true" HeaderText="Người cập nhật">
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <ItemStyle HorizontalAlign="Center" /></telerik:GridBoundColumn>
                </Columns>
                </MasterTableView>
            </telerik:radgrid>
        </div>
            <!--End Grid data--> 
            </fieldset>
            </telerik:RadPageView>
            <%-- End Chi tiết --%>
        </telerik:RadMultiPage>
        
        </div>
    </ContentTemplate>
<Triggers>
    <asp:PostBackTrigger ControlID="btnExportExcel"/>
    <asp:PostBackTrigger ControlID="btnExportDetail"/>
    
</Triggers>
</asp:UpdatePanel>
<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
